﻿using MediatR;
using W.Product.API.Appliaction.Command.ProductCommand;
using W.Product.Domain.Product;
using W.Product.Repository.Interface;

namespace W.Product.API.Appliaction.CommandHandler.ProductCommandHandler
{
    public class ProductFindCommandHandler : IRequestHandler<ProductFindCommand, ProductInfo>
    {
        private readonly IProductRepository _productRepository;

        public ProductFindCommandHandler(IProductRepository productRepository)
        {
            _productRepository = productRepository;
        }
        /// <summary>
        /// 产品管理反填
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public async Task<ProductInfo> Handle(ProductFindCommand request, CancellationToken cancellationToken)
        {
            var list= await _productRepository.FindById(request.ProductId);
            return list;
        }
    }
}
